package com.huawei.appgallery.forum.section.card;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.RemoteBuoyAction;
import com.huawei.appgallery.forum.base.ui.buoy.action.VideoNetChangeDialogAction;
import com.huawei.appgallery.forum.cards.card.ForumPostCard;
import com.huawei.appgallery.forum.posts.api.IPostDetailResult;
import com.huawei.appgallery.forum.section.buoy.action.OpenPostCommentAction;
import com.huawei.appgallery.forum.section.buoy.action.OpenUserHomeAction;
import com.huawei.appmarket.support.video.VideoPlayer;
import com.huawei.appmarket.support.video.fullscreen.FullScreenVideoPlayProtocol;
import com.huawei.appmarket.support.video.fullscreen.FullScreenVideoPlayProtocol.Request;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import huawei.widget.HwTextView;
import o.azb;
import o.bqx;
import o.bwx;
import o.bxc;
import o.bzf;
import o.bzg;
import o.cab.b;
import o.cab.c;
import o.cab.d;
import o.cab.e;
import o.cab.j;
import o.cdb;
import o.cjm;
import o.cjo;
import o.doo;
import o.ezn;
import o.faj;
import o.fho;
import o.fjc;
import o.fke;
import o.fkg;
import o.fo;

public class BuoyForumPostCard extends ForumPostCard implements bzg {
    public BuoyForumPostCard(Context context) {
        super(context);
    }

    public int ॱᐝ() {
        int i = this.ʼॱ.getResources().getConfiguration().orientation;
        if (i == 2) {
            return (azb.ॱ(this.ʼॱ) * 1) / 2;
        }
        if (i == 1) {
            return (int) (((float) azb.ॱ(this.ʼॱ)) * 0.8f);
        }
        return (int) (((float) azb.ॱ(this.ʼॱ)) * 0.8f);
    }

    public void ˎ(LinearLayout linearLayout) {
    }

    public int ॱˋ() {
        return this.ʼॱ.getResources().getDimensionPixelSize(c.ˎ) + this.ʼॱ.getResources().getDimensionPixelSize(c.ˏ);
    }

    public void ʼ() {
        if (this.ᐝॱ != null) {
            this.ᐝॱ.setPostTimeViewColor(fo.ˋ(this.ʼॱ, b.ᐝ));
            this.ᐝॱ.setUserNikeNameColer(fo.ˋ(this.ʼॱ, b.ʻ));
            this.ᐝॱ.setNickNameFakeViewColor(fo.ˋ(this.ʼॱ, b.ʻ));
            this.ᐝॱ.setUserDutiesViewColor(fo.ˋ(this.ʼॱ, b.ᐝ));
            View rootView = this.ᐝॱ.getRootView();
            if (rootView != null && this.ʼॱ != null && azb.ʼ(this.ʼॱ)) {
                rootView.setPaddingRelative(rootView.getPaddingStart() - azb.ᐝ(this.ʼॱ), rootView.getPaddingTop(), rootView.getPaddingEnd() - azb.ʽ(this.ʼॱ), rootView.getPaddingBottom());
                return;
            }
            return;
        }
        bqx.ॱ("BuoyForumPostCard", "postUserContentView is null");
    }

    public void ˋ(TextView textView) {
        if (this.ॱ != null) {
            View findViewById = this.ॱ.findViewById(e.ˎˎ);
            if (findViewById instanceof HwTextView) {
                ((HwTextView) findViewById).setTextColor(fo.ˋ(this.ʼॱ, b.ᐝ));
            }
            ((ImageView) this.ॱ.findViewById(e.ʼ)).setImageResource(d.ˎ);
            return;
        }
        bqx.ॱ("BuoyForumPostCard", "errorLayout is null");
    }

    public void ʻॱ() {
        if (this.ॱˎ.ˏॱ()) {
            this.ˎ.setReadedTextColor(fo.ˋ(this.ʼॱ, b.ᐝ));
            this.ˏ.setReadedTextColor(fo.ˋ(this.ʼॱ, b.ᐝ));
            return;
        }
        this.ˎ.setUnReadTextColor(fo.ˋ(this.ʼॱ, b.ʻ));
        this.ˏ.setUnReadTextColor(fo.ˋ(this.ʼॱ, b.ʻ));
    }

    public void ͺ() {
        this.ˏॱ.setTextColor(fo.ˋ(this.ʼॱ, b.ʻ));
        this.ˏॱ.setTextSize(0, (float) this.ʼॱ.getResources().getDimensionPixelSize(c.ˋ));
        if (this.ॱˎ.M_()) {
            this.ˊॱ.ˊ(d.ˏ);
        } else {
            this.ˊॱ.ˊ(d.ˋ);
        }
    }

    public void ʿ() {
        this.ᐝ.setTextColor(fo.ˋ(this.ʼॱ, b.ᐝ));
    }

    public void ॱˊ() {
        this.ˋॱ.setTextColor(fo.ˋ(this.ʼॱ, b.ʻ));
        this.ˋॱ.setTextSize(0, (float) this.ʼॱ.getResources().getDimensionPixelSize(c.ˋ));
        this.ॱˋ.setImageResource(d.ʻ);
    }

    public void ॱ(boolean z) {
        if (this.ॱˎ != null && this.ॱˎ.ʽ() != null) {
            if (z) {
                Intent intent = new Intent(this.ʼॱ, TransferActivity.class);
                intent.setAction(OpenPostCommentAction.ACTION);
                intent.putExtra("source_type", 1);
                intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_URI, this.ॱˎ.ʽ().ͺ());
                intent.putExtra("need_comment", z);
                intent.putExtra("post_status", this.ॱˎ.ʽ().ॱˊ());
                intent.putExtra("domain_id", this.ॱˎ.ॱ());
                OpenPostCommentAction.registerCall(new fjc<IPostDetailResult>(this) {
                    final /* synthetic */ BuoyForumPostCard ˋ;

                    {
                        this.ˋ = r1;
                    }

                    public /* synthetic */ void ˎ(int i, Object obj) {
                        ˋ(i, (IPostDetailResult) obj);
                    }

                    public void ˋ(int i, IPostDetailResult iPostDetailResult) {
                        if (i == -1 && iPostDetailResult != null) {
                            if (iPostDetailResult.getLike() >= 0) {
                                this.ˋ.ॱˎ.ˊ(iPostDetailResult.getLike());
                            }
                            if (iPostDetailResult.getLikeCount() >= 0) {
                                this.ˋ.ॱˎ.ʽ().ˋ(iPostDetailResult.getLikeCount());
                            }
                            this.ˋ.ˏ(true);
                            this.ˋ.ॱ(iPostDetailResult);
                        }
                    }
                });
                ((faj) cdb.ॱ(faj.class)).ˎ(this.ʼॱ, TransferActivity.class, intent, false);
                return;
            }
            Bundle bundle = new Bundle();
            bundle.putString("SEGMENT_URI", this.ॱˎ.ʽ().ͺ());
            bundle.putString("APPID", this.ॱˎ.ͺˏ());
            bundle.putInt("SOURCETYPE", 1);
            ((bzf) fho.ˏ().ˋ("Posts").ॱ(bzf.class)).ॱ(this.ʼॱ, bundle, this);
        }
    }

    public void ˊ(IPostDetailResult iPostDetailResult) {
        if (iPostDetailResult != null) {
            if (iPostDetailResult.getLike() >= 0) {
                this.ॱˎ.ˊ(iPostDetailResult.getLike());
            }
            if (iPostDetailResult.getLikeCount() >= 0) {
                this.ॱˎ.ʽ().ˋ(iPostDetailResult.getLikeCount());
            }
            ˏ(true);
            ॱ(iPostDetailResult);
        }
    }

    public void ᐝॱ() {
        if (this.ॱˎ != null && this.ॱˎ.ʽ() != null) {
            final int i = this.ॱˎ.M_() ? 1 : 0;
            ((bwx) fho.ˏ().ˋ("Operation").ॱ(bwx.class)).ˊ(this.ʼॱ, this.ॱˎ.ʽ().ॱˊ(), 0, this.ॱˎ.ʽ().ˏ(), i, this.ॱˎ.ॱ(), this.ॱˎ.ʼ(), true).ˏ(new fke<bxc>(this) {
                final /* synthetic */ BuoyForumPostCard ˏ;

                public /* synthetic */ void ॱ(Object obj) {
                    ˋ((bxc) obj);
                }

                public void ˎ(fkg o_fkg) {
                }

                public void ˋ(bxc o_bxc) {
                    if (o_bxc.ˏ() == 9 && o_bxc.ˎ()) {
                        bqx.ˏ("BuoyForumPostCard", "AUTHENTION_ACCESS is ok");
                        this.ˏ.ˎ(i);
                    } else if (o_bxc.ˏ() == 0 && o_bxc.ˎ()) {
                        bqx.ˏ("BuoyForumPostCard", "response is ok");
                    } else if (o_bxc.ˏ() == -1 && !o_bxc.ˎ()) {
                        bqx.ˏ("BuoyForumPostCard", "response is fail");
                        if (i == 1) {
                            this.ˏ.ˎ(0);
                        } else {
                            this.ˏ.ˎ(1);
                        }
                    }
                }

                public void ˊ(Exception exception) {
                }

                public void ॱ() {
                }
            });
        }
    }

    public void ʽॱ() {
        if (this.ॱˎ != null && this.ॱˎ.ᐝ() != null) {
            Intent intent = new Intent(this.ʼॱ, TransferActivity.class);
            intent.setAction(OpenUserHomeAction.ACTION_OPEN_UESR_HOME);
            intent.putExtra("UserId", this.ॱˎ.ᐝ().ॱ());
            intent.putExtra("Type", this.ॱˎ.ᐝ().ˊ());
            intent.putExtra("DomainId", this.ॱˎ.ॱ());
            ((faj) cdb.ॱ(faj.class)).ˎ(this.ʼॱ, TransferActivity.class, intent, false);
        }
    }

    public void ˏ(VideoPlayer videoPlayer) {
        if (videoPlayer != null) {
            videoPlayer.setBuoyNetChangeCallBack(new VideoPlayer.d(this) {
                final /* synthetic */ BuoyForumPostCard ˊ;

                {
                    this.ˊ = r1;
                }

                public void ˏ(Context context) {
                    ((faj) cdb.ॱ(faj.class)).ˊ(context, TransferActivity.class, new Intent(VideoNetChangeDialogAction.ACTION));
                }

                public void ˋ(Context context) {
                    ˏ(context);
                }
            });
            videoPlayer.setBuoyFullScreenMethod(new VideoPlayer.e(this) {
                final /* synthetic */ BuoyForumPostCard ॱ;

                {
                    this.ॱ = r1;
                }

                public void ˋ(Context context, String str, int i) {
                    if (doo.ˊ(context)) {
                        cjo fullScreenVideoPlayProtocol = new FullScreenVideoPlayProtocol();
                        Request request = new Request();
                        request.ˎ(str);
                        request.ˊ(i);
                        fullScreenVideoPlayProtocol.ˊ(request);
                        cjm o_cjm = new cjm("fullscreenvideoplay.activity", fullScreenVideoPlayProtocol);
                        o_cjm.ॱ().setAction("");
                        ((faj) cdb.ॱ(faj.class)).ॱ(context, null, o_cjm);
                        return;
                    }
                    ezn.ˊ().ˊ(context.getString(j.ˈ));
                }
            });
        }
    }
}
